import Vue from 'vue';
import VueRouter from 'vue-router';


// 导入组件
import Home from './components/tabbar/HomeContainer.vue';
import Search from './components/tabbar/SearchContainer.vue';
import Member from './components/tabbar/MemberContainer.vue';
import Shopcar from './components/tabbar/ShopcarContainer.vue';
import NewsList from './components/news/NewsList.vue';

import NewsInfo from './components/news/NewsInfo.vue';

// import demo from './components/demo.vue';

import PhotoList from './components/photos/PhotoList.vue';
import PhotoInfo from './components/photos/PhotoInfo.vue';

import GoodsList from './components/goods/GoodsList.vue';
import GoodsInfo from './components/goods/goodsinfo.vue';


Vue.use(VueRouter);

var router=new VueRouter({
    mode:'hash',
    routes:[
        {
            path:'/',
            redirect:'/home',
        },
        {
            path:'/home',
            component:Home,
            meta: {
                title:"首页"
            },
            beforeEnter(from,to,next){
                console.log('已经进入首页');
                next()
            }
        },
        {
            path:'/search',
            component:Search,
            meta: {
                title:"搜索"
            }
        },
        {
            path:'/member',
            component:Member,
            meta: {
                title:"会员"
            }
        },
        {
            path:'/shopcar',
            component:Shopcar,
            meta: {
                title:"购物车"
            }
        },
        {
            path:'/home/newslist',
            component:NewsList    
        },
        {
            path:'/home/newsinfo/:id',
            component:NewsInfo 
        },
        {
            path:'/home/pohtolist',
            component:PhotoList 
        },
        {
            path:'/home/photoinfo/:imgId',
            component:PhotoInfo 
        },
        {
            path:'/home/goodslist/',
            component:GoodsList
        },{
            path:"/home/goodsinfo/:id",
            component:GoodsInfo,
            props: true
        }
        
    ],
    linkActiveClass:'mui-active'
});
export default router;